import 'package:flutter/material.dart';
import 'package:test1/View/MyRowText.dart';
import 'package:device_info/device_info.dart';
import 'package:test1/pages/utils/DeviceUtils.dart';

class plug_device_info extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return plug_device_info_state();
  }
}

class plug_device_info_state extends State<plug_device_info> {
  AndroidDeviceInfo androidDeviceInfo;

  @override
  void initState() {
    super.initState();
    DeviceInfoPlugin _deviceInfoPlugin = DeviceInfoPlugin();
    Future<AndroidDeviceInfo> future = _deviceInfoPlugin.androidInfo;

    future.then((androidInfo) {
      setState(() {
        androidDeviceInfo = androidInfo;
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text("获取设备信息"),
        ),
        body: ListView(
          children: <Widget>[
            Text("androidId--：${androidDeviceInfo.androidId}\n"),
            Text("isPhysicalDevice--是否是模拟器，true不是，false是：${androidDeviceInfo.isPhysicalDevice}\n"),
            Text("brand-- ：${androidDeviceInfo.brand}\n"),
            Text("display-- ：${androidDeviceInfo.display}\n"),
            Text("fingerprint-- ：${androidDeviceInfo.fingerprint}\n"),
            Text("hardware-- ：${androidDeviceInfo.hardware}\n"),
            Text("host-- ：${androidDeviceInfo.host}\n"),
            Text("supportedAbis-- ：${androidDeviceInfo.supportedAbis.toString()}\n"),



            Text("getScreenWidth-- ：${DeviceUtils.getScreenWidth(context)}\n"),
            Text("getScreenHeight-- ：${DeviceUtils.getScreenHeight(context)}\n"),
            Text("getDevicePixelRatio-- ：${DeviceUtils.getDevicePixelRatio(context)}\n"),
            Text("getDeviceTop-- ：${DeviceUtils.getDeviceTop(context)}\n"),
            Text("getDeviceBottom-- ：${DeviceUtils.getDeviceBottom(context)}\n"),
          ],
        ),
      ),
    );
  }
}